<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="${pageContext.request.contextPath}/statics/bootstrap-3.3.5-dist/css/bootstrap.min.css" title="" rel="stylesheet" />
<link title="" href="${pageContext.request.contextPath}/statics/css/style.css" rel="stylesheet" type="text/css"  />
<link title="blue" href="${pageContext.request.contextPath}/statics/css/dermadefault.css" rel="stylesheet" type="text/css"/>
<link title="green" href="${pageContext.request.contextPath}/statics/css/dermagreen.css" rel="stylesheet" type="text/css" disabled="disabled"/>
<link title="orange" href="${pageContext.request.contextPath}/statics/css/dermaorange.css" rel="stylesheet" type="text/css" disabled="disabled"/>
<link href="${pageContext.request.contextPath}/statics/css/templatecss.css" rel="stylesheet" title="" type="text/css" />
<script src="${pageContext.request.contextPath}/statics/script/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/statics/script/jquery.cookie.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/statics/bootstrap-3.3.5-dist/js/bootstrap.min.js" type="text/javascript"></script>

<!--angular ui--->
<link rel="stylesheet" title="" type="text/css" href="ui-layout-0.0.0/ui-layout.css"/>
<script src="${pageContext.request.contextPath}/statics/script/angular.min.js"></script>
<script src="ui-layout-0.0.0/ui-layout.js"></script>
</head>
<body>
<div class="center-back right-back">
        <div class="container-fluid">
          <div class="info-center">
                    <div class="page-header">
                      <div class="pull-left">
						<h4>调整宿舍</h4>      
					</div>
                    <div class="pull-right">
                     <!-- <button type="button" class="btn btn-mystyle btn-sm">搜索</button>
                         <button type="button" class="btn btn-mystyle btn-sm">返回</button>
                          -->   
                    </div>
                    </div>
				    <div class="search-box row">
                       <div class="col-md-8" style="width: 100%;">
                          <form action="${pageContext.request.contextPath}/users/tohuansushe" method="post">
                        	<div class="form-group">
                          <span class="pull-left form-span">查找姓名:</span>
                           <input type="text" name="username" width="90px;" class="form-control" placeholder="请输入姓名" value="${username}">
                           </div>
                           <div class="form-group">
                            <input type="submit" class="btn btn-mystyle btn-sm" value="搜索"/>
                           </div>
                            </form>
                         	<div class="form-group">
                           </div>
                           
                           <div>
                           
                           <script type="text/javascript">
	$(function() {
		$("#floorid").change(function () {
            $("#layerid").empty();
            $("#layerid").append("<option value='00'>--请选择--</option>");

            var op=$(this).val();
            $.get("${pageContext.request.contextPath}/address/queryAddress",
                {"pid":op},function (result) {
                    $.each(result,function (index,address) {
                        $("#layerid").append("<option value='"+address.addressid+"'>"+address.name+"</option>");
                    });
                });
        });
		$("#layerid").change(function () {
            $("#roomid").empty();
            $("#roomid").append("<option value='00'>--请选择--</option>")
            var op=$(this).val();
            $.get("${pageContext.request.contextPath}/address/queryAddress",
                {"pid":op},function (result) {
                    $.each(result,function (index,address) {
                        $("#roomid").append("<option value='"+address.addressid+"'>"+address.name+"</option>");
                    });
                });

        });


	})
</script>
                           
                         <form action="${pageContext.request.contextPath}/users/tohuansushe" method="post">
                        楼区：
                          <select id="floorid" name="floorid"style="width: 10%;height: 33px; border-color: #ccc;border-radius: 5px;">
                          	<option value="00">--请选择--</option>
                          	<c:forEach items="${addlist}" var="add">
                          		<option value="${add.addressid}">${add.name}</option>
                          	</c:forEach>
                          </select>
		楼层：
                          <select id="layerid" name="layerid" style="width: 10%;height: 33px; border-color: #ccc;border-radius: 5px;">
                          	<option value="00">--请选择--</option>
                          </select>
                          房间：
                          <select id="roomid" name="roomid"  style="width: 10%;height: 33px; border-color: #ccc;border-radius: 5px;">
                          	<option value="00">--请选择--</option>
                          </select>
                            <input type="submit" style="width: 120px;" class="btn btn-mystyle btn-sm" value="搜索"/>
                         </form>
                           </div>
                         <!--  <div class="form-group">
                              <span class="pull-left form-span">状态:</span>
                              <select class="form-control">
                                <option>1</option>
                                <option>2</option>
                                <option>3</option>
                                <option>4</option>
                              </select>
                           </div>
                        <div class="form-group">
                          <input type="email" class="form-control" placeholder="请输件">                    
                       </div>
                       
                       
                       <div class="form-group btn-search">
                            <button class="btn btn-default" ><span class="glyphicon glyphicon-search"></span> 搜索</button>
                        </div>
                        </div>
                        <div class="col-md-4">
                         <div class="btn-group pull-right" role="group" aria-label="...">
                          <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> 新增</button>
                           <div class="btn-group" role="group">
                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                              <span class="glyphicon glyphicon-edit"></span> 审核
                              <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu">
                              <li><a href="#">通过</a></li>
                              <li><a href="#">不通过</a></li>
                            </ul>
                          </div>
                          <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> 编辑</button>
                         <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-trash"></span> 删除</button>
                        </div>
                        </div>
                         -->
                         
                    </div>
                    <div class="clearfix"></div>
                      <div class="table-margin">
                      <table class="table table-bordered table-header">
                      <thead>
                         <tr>
                           <td>头像</td>
                           <td class="w15" width="10%">昵称</td>
                           <td class="w70" width="70%">宿舍</td>
                           <td class="w15" width="20%">操作</td>
                         </tr>
                         </thead>
                         <tbody>
                         <c:if test="${empty page.list}">
                         <tr>
                         	<td colspan="4" align="center">查询无结果……</td>
                         </tr>
                         </c:if>
                         <c:forEach items="${page.list}" var="list">
                         <tr>
                          <td><img src="${list.headimg}" style="width: 50px; height: 50px;border-radius: 50%;" alt="" /></td>
                          <td>${list.username}</td>
                          <td>
							<select name="" id="" style="background-color: white;border: 0px;" disabled="disabled">
								<c:forEach items="${alladd}" var="all">
								<option value="${all.addressid}" <c:if test="${list.floorid==all.addressid}">selected="selected"</c:if>  >${all.name}</option>
								</c:forEach>
							</select>
							<select name="" id="" style="background-color: white;border: 0px;" disabled="disabled">
								<c:forEach items="${alladd}" var="all" >
								<option value="${all.addressid}" <c:if test="${list.layerid==all.addressid}">selected="selected"</c:if>  >${all.name}</option>
								</c:forEach>
							</select>
							<select name="" id="" style="background-color: white;border: 0px;" disabled="disabled">
								<c:forEach items="${alladd}" var="all">
								<option value="${all.addressid}" <c:if test="${list.roomid==all.addressid}">selected="selected"</c:if>  >${all.name}</option>
								</c:forEach>
							</select>
                        		  房间
                          
                          </td>
                          <td>
                         <a href="${pageContext.request.contextPath}/users/detailUsers?userid=${list.userid}"><button type="button" style="background-color: #FF9308;" class="btn btn-mystyle btn-sm">调换宿舍</button></a>
                         <a href="${pageContext.request.contextPath}/users/deleteUsers?userid=${list.userid}"><button type="button" style="background-color: #0099CC;" class="btn btn-mystyle btn-sm">移出宿舍</button></a>
                          </td>
                         </tr>
                         </c:forEach>
                         </tbody>
                         <tfoot>
		<tr>
				<td></td>
				<td >共 ${page.totalPageCount} 页|第 ${page.pageNo} 页</td>
				<td colspan="2" align="right">
				<c:if test="${page.pageNo==1 and page.pageNo<page.totalPageCount}">
					<span>首页</span>
					<span>上一页</span>
					<a href="${pageContext.request.contextPath}/users/tohuansushe?pageNo=${page.pageNo+1}">下一页</a>
					<a href="${pageContext.request.contextPath}/users/tohuansushe?pageNo=${page.totalPageCount}">末页</a>
				</c:if>
				<c:if test="${page.pageNo>1 and page.pageNo<page.totalPageCount}">
					<a href="${pageContext.request.contextPath}/users/tohuansushe?pageNo=1">首页</a>
					<a href="${pageContext.request.contextPath}/users/tohuansushe?pageNo=${page.pageNo-1}">上一页</a>
					<a href="${pageContext.request.contextPath}/users/tohuansushe?pageNo=${page.pageNo+1}">下一页</a>
					<a href="${pageContext.request.contextPath}/users/tohuansushe?pageNo=${page.totalPageCount}">末页</a>
				</c:if>
				<c:if test="${page.pageNo == page.totalPageCount and page.totalPageCount!=1}">
					<a href="${pageContext.request.contextPath}/users/tohuansushe?pageNo=1">首页</a>
					<a href="${pageContext.request.contextPath}/users/tohuansushe?pageNo=${page.pageNo-1}">上一页</a>
					<span>下一页</span>
					<span>末页</span>
				</c:if>
				<c:if test="${page.pageNo==1 and page.totalPageCount==1}">
					已经到底了……
				</c:if>
				</td>
			</tr>
                         </tfoot>
                      </table>
                      <p align="center">${message}</p>
                    </div>
                    </div>
          </div>
        </div>
        </div>
</body>
</html>